const { def } = require("@vue/shared")

class administrativeBody {
    constructor(area) {
        switch (area) {
            case "部":
                this.setBu()
                break
            case "省":
                this.setSheng()
                break
            case "市":
                this.setShi()
                break;
            case "县":
                this.setXian()
                break
        }
    }
    setBu() {
        console.log("部级用户")
    }
    setSheng() {
        console.log("省级用户")
    }
    setShi() {
        console.log("市级用户")
    }
    setXian() {
        console.log("县级用户")
    }
}
class userType {
    constructor(type) {
        let obj = {
            "管理员": "setAdministrator",
            "操作员": "setOperator",
            "使用员": "setUser"
        }
        if (obj[type]) {
            this[obj[type]]()
        }
    }
    setAdministrator() {
        console.log("管理员用户")
    }
    setOperator() {
        console.log("操作员用户")
    }
    setUser() {
        console.log("使用员用户")
    }
}

class User {
    constructor({ area, type }) {
        this.area = new administrativeBody(area)
        this.type = new userType(type)
    }
}

let user1 = new User({ area: "部", type: "操作员" })
export default User